/* Replication Code for "When Efforts to Depolarize the Electorate Fail" */ 
/* Begun: Spring 2016 */
/* Final Version: March 2018 */  

use "poq_replication_data" 

************************************************************
** Code Treatment & Background Varialbes Used in Analysis **
************************************************************ 

/* Generate Treatment Assignment Variable */ 
/* set treatment so that control is baseline (ambivalence = 1, affirmation = 2) */ 
gen treatment = . 
replace treatment = 0 if XTESS205 == 4 
replace treatment = 1 if XTESS205 == 2 
replace treatment = 2 if XTESS205 == 3 

/* Generate Party ID */ 
gen pid = . 
replace pid = 1 if Q1 == 1 & Q2A == 1 
replace pid = 2 if Q1 == 1 & Q2A == 2 
replace pid = 3 if (Q1 == 3 | Q1 == -1) & Q2C == 1
replace pid = 4 if Q2C == -1 /* refuse to answer leaner */ 
replace pid = 5 if (Q1 == 3 | Q1 == -1) & Q2C == 2
replace pid = 6 if Q1 == 2 & Q2B == 2
replace pid = 7 if Q1 == 2 & Q2B == 1

gen dem = . 
replace dem = 1 if pid < 4 
replace dem = 0 if pid > 4 

gen rep = . 
replace rep = 1 if pid > 4 
replace rep = 0 if pid < 4 

gen sp = 0 
replace sp = 1 if pid == 1 | pid == 7  

gen libcon = . 
replace libcon = xIdeo if xIdeo > 0 
gen lc_fold = abs(libcon-4) 
gen not_mod = 0 
replace not_mod = 1 if lc_fold > 1 
replace not_mod = 0 if xIdeo == -1 /* DK ideo set to 0 here */   
gen mod = 0 if not_mod == 1 
replace mod = 1 if not_mod == 0 
 
/* race: white = 1, black = 2, hispanic = 3, other = 4 */ 
gen race = . 
replace race = 1 if ppethm == 1 
replace race = 2 if ppethm == 2 
replace race = 3 if ppethm == 3 
replace race = 4 if ppethm == 4 

gen white = . 
replace white = 1 if race == 1 
replace white = 0 if race > 1 
 
gen college = 0 
replace college = 1 if ppeducat == 4  

gen female = 0 
replace female = 1 if ppgender ==2 

/* Income distribution, in thirds */ 
gen inc_third = .  
replace inc_third = 0 if ppincimp < 9 
replace inc_third = 1 if ppincimp > 9 & ppincimp < 15 
replace inc_third = 2 if ppincimp > 14 

/* closeness of primary: had primary between 4/1 and 5/15 (2 weeks on either side of sample) */ 
gen primary = 0 
replace primary = 1 if ppstaten == 35 | ppstaten == 84 | ppstaten == 83 | ppstaten == 21 | ppstaten == 16 | ppstaten == 15 | ppstaten == 23 | ppstaten == 51 

******************************************
** Manipulation Check: Self-Affirmation ** 
****************************************** 

gen sa1 = . 
replace sa1 = (-1*Q4C2) + 5 if Q4C2 > 0 
gen sa2 = . 
replace sa2 = (-1*Q3D_) + 5 if Q3D_ > 0 
gen self_affirm = sa1 if treatment == 2 
replace self_affirm = sa2 if treatment == 0 
gen se_treat = 0 if treatment == 0 
replace se_treat = 1 if treatment == 2 
reg self_affirm se_treat 
/* trait is more important */ 

*************************
** Dependent Variables ** 
************************* 

/* Other Party FT */ 
gen other_ft = . 
replace other_ft = Q6 if Q6 > -1 & dem == 1 
replace other_ft = Q5 if Q5 > -1 & rep == 1 

/* Feeling Thermometer Transformations */ 
gen pos_ft = 0 
replace pos_ft = 1 if other_ft > 49 
gen zero_ft =0 
replace zero_ft = 1 if other_ft == 0 

/* Danger to Nation */ 
gen danger = . 
replace danger = (-1*Q7) + 6 if Q7 > 0 

/* Comfortable as Friends */ 
gen friends = . 
replace friends = (-1*Q10) + 5 if Q10 > 0 

/* Discussion Group: higher values mean heterogeneity */ 
gen group = . 
replace group = Q8 if Q8 > 0 & dem == 1 
replace group = (-1*Q8) + 8 if Q8 > 0 & rep == 1 

*************
** Table 1 ** 
************* 

/* Tables of Results*/ 
/* Basic Table: Show ITT Results */ 
reg other_ft i.treat 
outreg2 using itt_results.doc, dec(2)   
reg danger i.treat 
outreg2 using itt_results.doc, dec(2) append   
reg friends i.treat 
outreg2 using itt_results.doc, dec(2) append    
reg group i.treat 
outreg2 using itt_results.doc, dec(2) append 

/* Treatment Compliance? */ 
mean OutParty_Valid 
mean SE_Valid 
/* MR in who complies with ambivalence treatment? */ 
reg OutParty_Valid mod 
reg OutParty_Valid sp  

*************
** Table 2 ** 
*************

/* Output Table */ 
reg other_ft i.treat##i.not_mod  
test 1.treatment + 1.treatment#1.not_mod = 0 /* no effect for ideologues*/ 
outreg2 using mod.doc, dec(2) 
reg danger i.treat##i.not_mod  
test 1.treatment + 1.treatment#1.not_mod = 0  /* null effect for moderates, polarizing effect for others */ 
outreg2 using mod.doc, dec(2) append 
reg friends i.treat##i.not_mod 
test 1.treatment + 1.treatment#1.not_mod = 0  /* no effect of either one */  
outreg2 using mod.doc, dec(2) append  
reg group i.treat##i.not_mod  
test 1.treatment + 1.treatment#1.not_mod = 0  /* one tailed effect for moderates */  
outreg2 using mod.doc, dec(2) append 
reg other_ft i.treat##i.sp  
outreg2 using mod.doc, dec(2) 
reg danger i.treat##i.sp  
outreg2 using mod.doc, dec(2) append 
reg friends i.treat##i.sp 
outreg2 using mod.doc, dec(2) append  
reg group i.treat##i.sp  
outreg2 using mod.doc, dec(2) append 

/* other FT reg by moderate */ 
reg zero_ft i.treat##i.not_mod   

/* strongly agree the other party is a danger */ 
gen binary_danger = 0 
replace binary_danger = 1 if danger ==5  
reg binary_danger i.treat##i.not_mod  

 
*****************************
** Appendix Tables A1 - A7 **
***************************** 

/* Partisan heterogeneity? */ 
reg other_ft i.treat##rep  
outreg2 using part_het.doc, dec(2)  
reg danger i.treat##rep  
outreg2 using part_het.doc, dec(2) append 
**test 1.treatment + 1.treatment#1.rep =0 
reg friends i.treat##rep 
outreg2 using part_het.doc, dec(2) append 
reg group i.treat##rep 
outreg2 using part_het.doc, dec(2) append 

/* Heterogeneity by Age? */  
reg other_ft i.treat##c.ppagect4  
outreg2 using het_age.doc, dec(2)
reg danger i.treat##c.ppagect4 
outreg2 using het_age.doc, dec(2) append 
reg friends i.treat##c.ppagect4 
outreg2 using het_age.doc, dec(2) append 
reg group i.treat##c.ppagect4 
outreg2 using het_age.doc, dec(2) append 

/* Heterogeneity by gender? */ 
reg other_ft i.treat##female  
outreg2 using het_sex.doc, dec(2) 
reg danger i.treat##female  
outreg2 using het_sex.doc, dec(2) append 
reg friends i.treat##female 
outreg2 using het_sex.doc, dec(2) append 
reg group i.treat##female  
outreg2 using het_sex.doc, dec(2) append 
/* no real gender heterogeneity */ 

/* Heterogeneity by race? */ 
reg other_ft i.treat##white 
outreg2 using het_race.doc, dec(2)  
reg danger i.treat##white  
outreg2 using het_race.doc, dec(2) append 
reg friends i.treat##white 
outreg2 using het_race.doc, dec(2) append 
reg group i.treat##white  
outreg2 using het_race.doc, dec(2) append 
/* no real racial heterogeneity */ 

/* Heterogeneity by education? */ 
reg other_ft i.treat##c.ppeducat 
outreg2 using het_educ.doc, dec(2)  
reg danger i.treat##c.ppeducat 
outreg2 using het_educ.doc, dec(2) append 
reg friends i.treat##c.ppeducat
outreg2 using het_educ.doc, dec(2) append 
reg group i.treat##c.ppeducat  
outreg2 using het_educ.doc, dec(2) append 

/* Heterogeneity by income? (top third of the income scale) */ 
gen rich = 0 
replace rich = 1 if ppincimp > 14 

reg other_ft i.treat##rich 
outreg2 using het_inc.doc, dec(2)  
reg danger i.treat##rich 
outreg2 using het_inc.doc, dec(2) append 
reg friends i.treat##rich 
outreg2 using het_inc.doc, dec(2) append 
reg group i.treat##rich  
outreg2 using het_inc.doc, dec(2) append  

/* Look at effects of nearby primary */ 
reg other_ft i.treat##i.primary  
outreg2 using primary.doc, dec(2)  
reg danger i.treat##i.primary 
outreg2 using primary.doc, dec(2) append 
reg friends i.treat##i.primary 
outreg2 using primary.doc, dec(2) append 
reg group i.treat##i.primary 
outreg2 using primary.doc, dec(2) append 
/* no effects (using either primary or primary2)  */ 
